﻿using System.Windows;
using Microsoft.Phone.Controls;

namespace Counter
{
    public partial class MainPage : PhoneApplicationPage
    {
        private int _counter;

        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void BtnReset_Click(object sender, RoutedEventArgs e)
        {
            _counter = 0;
            TbCountBoard.Text = _counter.ToString("N0");
        }

        private void LayoutRoot_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            _counter++;
            TbCountBoard.Text = _counter.ToString("N0");
        }

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            TbCountBoard.Text = _counter.ToString("N0");
        }

    }
}